﻿create proc [dbo].[proc_GetDepartmentIdByDName]
(
  @DName varchar(100)
)
AS
BEGIN

;with cte as 
(
select Id from Department where DName=@DName
union all
select  a.Id from Department as a,cte as b where a.ParentId=b.id

)
SELECT * from cte

END
